/*
 * UsersListRenderer.java
 *
 * Created on 4 wrzesień 2007, 16:14
 *
 * To change this template, choose Tools | Template Manager
 * and open the template in the editor.
 */

package pl.krakow.ae.knp.wikiboard.gui.userslist;

import java.awt.Component;
import java.awt.Font;
import javax.swing.JLabel;
import javax.swing.JList;
import javax.swing.ListCellRenderer;
import javax.swing.DefaultListCellRenderer;
import pl.krakow.ae.knp.wikiboard.gui.GUI;

/**
 *
 * @author Michał
 */
public class UsersListRenderer extends JLabel
        implements ListCellRenderer {
    
    protected DefaultListCellRenderer defaultRenderer = new DefaultListCellRenderer();
    
    /** Creates a new instance of UsersListRenderer */
    public UsersListRenderer() {
        setOpaque(true);
        setHorizontalAlignment(CENTER);
        setVerticalAlignment(CENTER);
    }
    public Component getListCellRendererComponent(
            JList list, Object value, int index, boolean isSelected, boolean cellHasFocus) {
        
        JLabel renderer = (JLabel) defaultRenderer.getListCellRendererComponent
                (list, value, index, isSelected, cellHasFocus);
        renderer.setFont(new Font("Courier", Font.ITALIC, 14));
        if ( (value.toString()).equals(GUI.getUserName()) )
            renderer.setFont(new Font("Courier", Font.BOLD, 15));              
        
        return renderer;

    }
}
